//
//  DYAddPermissionVC.m
//  kafuMerchant
//
//  Created by 帝云科技 on 2018/9/19.
//  Copyright © 2018年 帝云科技. All rights reserved.
//

#import "DYAddPermissionVC.h"
#import "DYAddPermissionView.h"
#import "DYAddPermissionCell.h"

@interface DYAddPermissionVC ()

@property (nonatomic,strong) DYAddPermissionView *headerView;
@property (nonatomic,strong)UIButton *submitButton;
@property (nonatomic,strong)UIView *footerView;

@end

@implementation DYAddPermissionVC

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
}
-(void)dy_initData
{
    [super dy_initData];
    
    self.navigationItem.title=@"新增权限组";
    NSArray *array=@[@[@"商铺信息",@"基本信息",@"我要装修",@"我要收款",@"我要发卡",@"我要认证"],@[@"店铺管理",@"分店管理",@"员工管理",@"权限管理"],@[@"发卡管理",@"卡片设置",@"充值设置",@"备案管理"],@[@"会员管理",@"会员管理"],@[@"营销管理",@"充值赠送",@"充值优惠",@"代金券",@"免费赠品"],@[@"商家头条",@"商家头条"],@[@"评价管理",@"评价管理"],@[@"财务管理",@"充值记录",@"收款记录",@"业绩统计"],@[@"资金管理",@"资金流水",@"提现记录"]];
    self.dataArray=[NSMutableArray arrayWithArray:array];
}
-(void)dy_initUI
{
    [super dy_initUI];
    
    self.tableView.tableHeaderView=self.headerView;
    self.tableView.tableFooterView=self.footerView;
    [self.tableView registerClass:[DYAddPermissionCell class] forCellReuseIdentifier:@"DYAddPermissionCell"];

}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataArray.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row==0||indexPath.row==4) {
         return BILIHEIGHT(72);
    }
    return BILIHEIGHT(37);
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    DYAddPermissionCell *cell=[tableView dequeueReusableCellWithIdentifier:@"DYAddPermissionCell" forIndexPath:indexPath];
    [cell getArray:self.dataArray[indexPath.row]];
    return cell;
}
-(void)submitButtonClick
{
    
}
-(DYAddPermissionView *)headerView
{
    if (!_headerView) {
        _headerView=[[DYAddPermissionView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, BILIHEIGHT(90))];
    }
    return _headerView;
}
-(UIButton *)submitButton
{
    if (!_submitButton) {
        _submitButton=[Utils createBtnWithType:UIButtonTypeCustom backgroundColor:[UIColor xhq_base] action:@selector(submitButtonClick) target:self title:@"确认提交" image:@"icon_login" font:17 textColor:WhiteColor];
        _submitButton.frame=CGRectMake(kScreenWidth-BILIWIDTH(142),BILIHEIGHT(50), BILIWIDTH(132), BILIHEIGHT(38));
        [_submitButton placeImageTitlePosition: ZYButtonImagePositionRight space:BILIWIDTH(10)];
        [_submitButton xhq_cornerRadius:BILIHEIGHT(19)];
    }
    return _submitButton;
}
-(UIView *)footerView
{
    if (!_footerView) {
        _footerView=[[UIView alloc]initWithFrame:CGRectMake(0, 0, kScreenWidth, BILIHEIGHT(100))];
        _footerView.backgroundColor=WhiteColor;
        [_footerView addSubview:self.submitButton];
    }
    return _footerView;
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
